$(function(){
	var data = {
			url: path+'/distribution/sale-order',
			method: 'GET',//请求方式（*）
			contentType : "application/x-www-form-urlencoded;charset='UTF-8'",
			sortable: true,
			sortOrder: "asc",
			search: false,
			columns:[
				[   
					{
						checkbox:true,
						colspan: 1,
				        rowspan: 2
					},{
						field: 'id',
				        colspan: 1,
				        rowspan: 2,
				        visible: false
					},{
				    	field: 'datetime',
				        title: "日期",
				        halign:"center",
				        align: "center",
				        colspan: 1,
				        rowspan: 2
				    },{
				    	field: 'specifications',
				        title: "品名规格",
				        halign:"center",
				        align:"center",
				        colspan: 1,
				        rowspan: 2
				    },{
				    	field: 'unit',
				        title: "单位",
				        halign:"center",
				        align:"center",
				        colspan: 1,
				        rowspan: 2
				    },{
				    	field: 'number',
				        title: "来料数量",
				        halign:"center",
				        align:"center",
				        colspan: 1,
				        rowspan: 2
				    },{
				        title: "成品",
				        halign:"center",
				        align:"center",
				        colspan: 3,
				        rowspan: 1
				    },{
				    	field: 'remark',
				        title: "备注",
				        halign:"center",
				        align:"center",
				        colspan: 1,
				        rowspan: 2
				    }
				],[
				    {
				        field: 'outedNumber',
				        title: "已出货数量",
				        valign:"middle",
				        align:"center",
				        colspan: 1,
				        rowspan: 1
				    },{
				    	field: 'atFinishedNumber',
				        title: "现完成数量",
				        valign:"middle",
				        align:"center",
				        colspan: 1,
				        rowspan: 1
				    },{
				    	field: 'atLackNumber',
				        title: "现差数量",
				        valign:"middle",
				        align:"center",
				        colspan: 1,
				        rowspan: 1
				    }
				]
			],
			exportOptions:{  
			   fileName: '销售情况'+exportDate.toLocaleString(),
			   worksheetName: 'sheet1',//表格工作区名称  
			   tableName: '销售情况',
				           ignoreColumn: [0,1],
						   unaffectedColumn:0
			}
	}
	
	var param = [{text:"日期",name:"dateScope",type:"text",verify:""},{text:"品名规格",name:"specifications",type:"text",verify:""},{text:"单位",name:"unit",type:"text",verify:"chineseStr"}];
	
	//渲染表格
	renderTable(cTable,data);
	
	createQueryPanel(param);
	
	//条件查询 日期组建渲染
	laydate.render({
		 elem:  "[name='dateScope']"
		 ,type: 'datetime'
		 ,range: true
	});

	//渲染组建
	form.render();
})

//添加按钮
$("#add_btn").click(function(){
	openOperateWindow({
		title: "添加销售单",
		url: "/admin/enterpriseManagement/distributionManagement/saleOrder/sale-order-add.jsp"
	})
})

//删除按钮
$("#remove_btn").click(function(){
	fixedAlert("禁止删除货物!请到货物盘点中进行操作!",0);
})

//修改按钮
$("#modify_btn").click(function(){
	openOperateWindow({
		title: "修改销售单",
		isUpdate: true,
		url: "/admin/enterpriseManagement/distributionManagement/saleOrder/sale-order-update.jsp"
	})
})